package main

import (
	"fmt"

	_ "github.com/go-sql-driver/mysql"

	"github.com/jinzhu/gorm"
)

// 创建animal结构体1
type Animal struct {
	ID   int64  `gorm:"column:name;not null;primary_key;AUTO_INCREMENT"`
	Name string `gorm:"column:name"`
	Age  int64  `gorm:"column:age"`
}

func main() {
	db, err := gorm.Open("mysql", "root:root@/gormdemo?charset=utf8&parseTime=true&loc=Local")
	if err != nil {
		fmt.Println("connect db error: ", err)
	}
	defer db.Close()

	db.Debug().Where("id = 5").Delete(&Animal{})
}
